﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using log4net;

namespace LogForNetApp
{
    internal class LogHelper
    {
        public static ILog log = LogManager.GetLogger(typeof(LogHelper));

        public static List<Tip> fatals = new List<Tip>();
        public static List<Tip> errors = new List<Tip>();
        public static List<Tip> warns = new List<Tip>();
        public static List<Tip> infos = new List<Tip>();
        public static List<Tip> debugs = new List<Tip>();
        public static void WriteFatal(object s)//危险错误
        {
            log.Fatal(s);
            //fatals.Add(new Tip() { Id = fatals.Count + 1, Name = s.ToString(), dateTime = DateTime.Now });
        }
        public static void WriteInfo(object s)//通常信息
        {
            log.Info(s);
        }
        public static void WriteError(object s)//运行错误
        {
            log.Error(s);
        }
        public static void WriteWarning(object s)//写警告
        {
            log.Warn(s);
        }
        public static void WriteDebug(object s)//debug日志
        {
            log.Debug(s);
        }
    }

    public class Tip
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public DateTime dateTime { get; set; }
    }
}
